# -- coding: utf-8 --
#上面这个解决的是中文注释报错问题

#day1:10
def day1():
    x = 2
    y = 2
    x = 5
    L = list('python')
    print id(x)
    print id(y)
    print L
    if True: print "print"
    a = 2 ** 32
    print a  # long 类型
    print type(a)
    a = 2 ** 12  # int类型，为了演示python自动类型转换
    print type(a)
    name_list = ['a', 'b', 'c']  # 数组类型
    print type(name_list)
    name_map = {'name': 'yzy', 'age': 89}  # 字典类型，对应的是map类型
    print(type(name_map))
    print name_map['name']  # 获取字典中的元素
    print 3 / 2  # 整除，只取整数部分
    print 3.0 / 2  # 不是整除
    print 9 % 5  # 取模,取余数
    print 10 // 3  # 取整
    print 3 <> 3.0
    c = 3
    c = c + 3
    print c
    print ord('a')  # 查看a的ASCII
    print ord('A')
    a = u'中国人'  # a的值为uicode编码的abc
    print len(a)
    print type(a)
    print a.encode('utf-8')  # 将a转为utf-8
    print type(a)
    print len(a)

def way2():
    import os
    # os.system("dir")
    import commands
    print commands.getstatusoutput("dir")
    import sys
    print sys.argv[0]

def way3():
    name=raw_input('input your name:')
    age=input('input your age:')
    job=raw_input('input your job:')
    salary=raw_input('input your salary:')
    print 'name:'+name+'age'+str(age)
    print type(age)
    # %d表示只能填数字，#f表示只能填写float
    print '''
    person information of %s:
        name: %s
        age: %d
        job: %s
        salary: %s
    ''' %(name,name,age,job,salary)

def way4():
    num=20
    for i in range(1,20,1):
        num += 1
    if num > 50:
        print "大于50"
        print num
    elif num >40:
        print "大于40"
        print num
    else:
        print "小于40"
        print num

def way5():
    count=1
    while count<100:
        print 'loop',count
        count+=1
    else:
        print "-----"
        print count

def way6():
    count=1
    while True:
        print 'loop',count
        count+=1

def way7():
    cricle=input("loop cricle")
    count=0
    while count < cricle:
        print count
        count +=1
        choise=raw_input("do you want to continue loop?(y/n)")
        print type(choise)
        if choise == "y":
            break
        else:
            continue
        print "123"

def way8():
    a="123"
    b="123"
    # 这两个函数均能接收 字符串 ，但 raw_input() 直接读取控制台的输入（任何类型的输入它都可以接收）。而对于 input() ，它希望能够读取一个合法的 python 表达式，即你输入字符串的时候必须使用引号将它括起来，否则它会引发一个 SyntaxError
    # choise = input("input y/n")  #如果要输入y，就必须输入'y'
    choise = raw_input("input y/n") #如果要输入y，就只须输入y，不用加''
    type(choise)
    if  "y"== choise:
        print "a==b"
    print a==b
    print a
    print type(a)

def whileWay():
    num=input("input num")
    count=0
    while count <10000:
        if(count==num):
            choice=raw_input("input y/n")
            if choice=="y":
                print "exit loop,cricle=",count
                break
        else:
            print count
        count+=1
    else:
        print "loop:",count

def loginWay():
    count=0
    while True:
        flag=True
        count+=1
        if(flag):
            userName = raw_input("input your username")
            password = raw_input("input your password")
            if(userName=="yzy" and password=="yzy"):
                flag = False
                print userName, ",登录成功"
                break
            else:
                print "用户名、密码输入错误"
                if(count>=3):
                    print userName,"登录失败3次"
                    break





# def str inputMessage():


if __name__=="__main__":
   # day1()
   # way2()
   # way7()
   loginWay()